package vip.lsjscl.flowboot.workflow.entity;

import jakarta.persistence.*;
import lombok.Data;
import org.hibernate.annotations.Comment;
import vip.lsjscl.flowboot.util.converter.FlowDiagramConverter;
import vip.lsjscl.flowboot.workflow.model.FlowDiagram;

/**
 * 工作流版本
 * 用于管理工作流的不同版本记录
 *
 * @author zhangxingju
 * @date 2025/02/15
 */
@Data
@Entity
@Table(name = "dk_workflow_version", indexes = {
        @Index(name = "idx_workflow_version_workflow_id", columnList = "workflow_id"),
        @Index(name = "idx_workflow_version_version", columnList = "version")
})
public class DKWorkflowVersion extends BaseEntity {

    @Comment("工作流ID")
    @Column(name = "workflow_id")
    private String workflowId;

    @Comment("版本号")
    @Column(name = "version")
    private Integer version;

    @Comment("工作流名称")
    @Column(name = "name")
    private String name;

    @Comment("工作流编码")
    @Column(name = "code")
    private String code;

    @Comment("工作流定义数据")
    @Column(name = "flow_data", columnDefinition = "text")
    @Convert(converter = FlowDiagramConverter.class)
    private FlowDiagram flowData;
}